#include "app_buffer.h"

int main(int argc, char const *argv[])
{
    buffer_handle_t buffer_handle = app_buffer_init(10);
    app_buffer_write(buffer_handle, "abcd", 4);
    app_buffer_write(buffer_handle, "efghi", 5);
    app_buffer_write(buffer_handle, "a", 1);

    char data[1024];
    int real_len = app_buffer_read(buffer_handle, data, sizeof(data));
    log_debug("长度:%d 数据:%.*s", real_len, real_len, data);

    real_len = app_buffer_read(buffer_handle, data, sizeof(data));
    log_debug("长度:%d 数据:%.*s", real_len, real_len, data);

    real_len = app_buffer_read(buffer_handle, data, sizeof(data));
    log_debug("长度:%d 数据:%.*s", real_len, real_len, data);

    return 0;
}
